package com.xidian.zhiancloud.dao.syset;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.github.pagehelper.Page;
import com.xidian.zhiancloud.model.syset.*;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface SysUserMapper extends BaseMapper<SysUser> {
    // 登录
	SysUser login(@Param("username") String username, @Param("password") String password, @Param("passkey") String passkey);
	// 用户列表
	Page<SysUser> getUserList(@Param("orgid") Integer orgid, @Param("departid") Integer departid, @Param("jobid") Integer jobid, @Param("roleid") Integer roleid, @Param("searchkey") String searchkey);
	// 组织层级
	List<OrgLeveList> getOrgLeveList(@Param("companyId") Long companyId);
	// 组织机构
	List<Organization> getOrgList(@Param("companyId") Long companyId);
	// 职位列表
	Page<JobList> getJobList(@Param("companyId") Long companyId,
                             @Param("searchkey") String searchkey);
	// 岗位列表
	Page<DepartList> getDepartList(@Param("companyId") Long companyId,
	    @Param("searchkey") String searchkey, @Param("orgid") Integer orgid, @Param("jobid")  Integer jobid);
	// 角色列表
	List<RoleList> getRoleList();
	// 获取设置的菜单的权限
	List<MenuList> getMenuRightByRoleid(@Param("roleid") Integer roleid);
	// 获取登录用户的菜单
	List<MenuList> getMenuByRoleid(@Param("roleids") String roleids);
	// 获取所有菜单列表
	List<MenuList> getMenuByAdmin(@Param("defant") Integer defant);

	int insertUser
			(@Param("data") SysUser data,
			 @Param("passkey") String passkey);
	
	List<SysUser> selectUserList();

	int deletByUserId(List<String> list);

	int updateByOrgLevelId(@Param("id") String id,
		@Param("customtypename") String customtypename);

	int deletByJobId(List<String> lists);

	int addJobMes(@Param("data") JobList job);

	int updateJobMes(@Param("id") String id,
					 @Param("num") Integer num,@Param("name") String name,Integer createId);

	int updateUser (@Param("id") String id,@Param("data") SysUser data,
			 @Param("passkey") String passkey);

    Page<Organization> getexportOrgList(@Param("companyId") Long companyId);

	String importUserData(
			@Param("companyId") Long companyId,
			@Param("data") List<SysUser> data,
			boolean updateSupport);
	
	List<Organization> getdeptListByName(String[] depts);
	List<JobList> getJobListByName(String[] jobs);
	int insertImportUser(@Param("data")SysUser user);
	void updateLeaderOrg(List<Long> deptsId, @Param("userId")Long userId);

    SysUser getByUserAndSuperAdministrator(@Param("companyId") Long companyId);

    int addDepart(@Param("data") DepartList data);

    int updateDepart(@Param("id") String id,@Param("data") DepartList depart);

    int deleteDepart(List<String> lists);

    DepartList getByDepartAndIdAndName(
        @Param("companyId") Long companyId,@Param("name") String name);

    JobList getByJobAndIdAndName(
        @Param("companyId") Long companyId,@Param("name") String name);

    List<SysUser> getByUserIdAndRoleIds(List<String> list);
    
    int updateByIdAndRoleIds(List<SysUser> list);
    
    List<String> getByUserIDList(Long companyId,String jobids);

    List<Long> getByJobIdAndUserID(Long companyId,String jobids);

    List<DepartList> getByOrgidAndJobid(Long companyId,List<Integer> oidList,List<Integer> jidList);

    List<SysUser> getUserPhonle(Long companyId,String phone);

    int updateByPassword(String id,String newPassword,String passKey);
    
}
